package FilePanel;


import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.io.File;

import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;

/**
 * @author      Erwan Osouf, Lucas Ennouchi
 * @version     1.0                                
 * @since       29/01/2012
 */

public class FilePanelUI extends JPanel{

	private static final long serialVersionUID = 1L;
	private JList fileList;
	private JTextField fileSelectionField;
	private JButton fileSelectionButton;
	private JButton fileChooserButton;
	private JFileChooser fileChooser;
	
	public FilePanelUI() {
		super();
		this.setPreferredSize(new Dimension(300,300));
		initComponents();
	}
	
	/**
	 * init the components of the UI
	 */
	private void initComponents() {
		fileList = new JList();
		fileSelectionField = new JTextField();
		fileSelectionField.setColumns(15);
		fileSelectionButton = new JButton("Choisir");
		fileChooserButton = new JButton("FileChooser");
		fileSelectionButton.setEnabled(false);
		fileChooser = new JFileChooser();
		fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
		Container controls = new JPanel(new GridLayout(3,1));
		this.add(new JScrollPane(fileList,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED));
		controls.add(fileSelectionField);
		controls.add(fileChooserButton);
		controls.add(fileSelectionButton);
		this.add(controls);
	}

	public JButton getFileChooserButton() {
		return fileChooserButton;
	}

	public JList getFileList() {
		return fileList;
	}

	public JTextField getFileSelectionField() {
		return fileSelectionField;
	}

	public JButton getFileSelectionButton() {
		return fileSelectionButton;
	}
	
	public JFileChooser getFileChooser(){
		return this.fileChooser;
	}
	

	
	
}
